home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / gxpaint.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  2.8 KB  |  88 lines

  1. /* Copyright (C) 1995, 1996, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: gxpaint.c,v 1.2 2000/09/19 19:00:39 lpd Exp $ */
  20. /* Graphics-state-aware fill and stroke procedures */
  21. #include "gx.h"
  22. #include "gzstate.h"
  23. #include "gxdevice.h"
  24. #include "gxhttile.h"
  25. #include "gxpaint.h"
  26. #include "gxpath.h"
  27.  
  28. /* Fill a path. */
  29. int
  30. gx_fill_path(gx_path * ppath, gx_device_color * pdevc, gs_state * pgs,
  31.          int rule, fixed adjust_x, fixed adjust_y)
  32. {
  33.     gx_device *dev = gs_currentdevice_inline(pgs);
  34.     gx_clip_path *pcpath;
  35.     int code = gx_effective_clip_path(pgs, &pcpath);
  36.     gx_fill_params params;
  37.  
  38.     if (code < 0)
  39.     return code;
  40.     params.rule = rule;
  41.     params.adjust.x = adjust_x;
  42.     params.adjust.y = adjust_y;
  43.     params.flatness = (pgs->in_cachedevice > 1 ? 0.0 : pgs->flatness);
  44.     params.fill_zero_width = (adjust_x | adjust_y) != 0;
  45.     return (*dev_proc(dev, fill_path))
  46.     (dev, (const gs_imager_state *)pgs, ppath, ¶ms, pdevc, pcpath);
  47. }
  48.  
  49. /* Stroke a path for drawing or saving. */
  50. int
  51. gx_stroke_fill(gx_path * ppath, gs_state * pgs)
  52. {
  53.     gx_device *dev = gs_currentdevice_inline(pgs);
  54.     gx_clip_path *pcpath;
  55.     int code = gx_effective_clip_path(pgs, &pcpath);
  56.     gx_stroke_params params;
  57.  
  58.     if (code < 0)
  59.     return code;
  60.     params.flatness = (pgs->in_cachedevice > 1 ? 0.0 : pgs->flatness);
  61.     return (*dev_proc(dev, stroke_path))
  62.     (dev, (const gs_imager_state *)pgs, ppath, ¶ms,
  63.      pgs->dev_color, pcpath);
  64. }
  65.  
  66. int
  67. gx_stroke_add(gx_path * ppath, gx_path * to_path,
  68.           const gs_state * pgs)
  69. {
  70.     gx_stroke_params params;
  71.  
  72.     params.flatness = (pgs->in_cachedevice > 1 ? 0.0 : pgs->flatness);
  73.     return gx_stroke_path_only(ppath, to_path, pgs->device,
  74.                    (const gs_imager_state *)pgs,
  75.                    ¶ms, NULL, NULL);
  76. }
  77.  
  78. int
  79. gx_imager_stroke_add(gx_path *ppath, gx_path *to_path,
  80.              gx_device *dev, const gs_imager_state *pis)
  81. {
  82.     gx_stroke_params params;
  83.  
  84.     params.flatness = pis->flatness;
  85.     return gx_stroke_path_only(ppath, to_path, dev, pis,
  86.                    ¶ms, NULL, NULL);
  87. }
  88.